/**
 * 初始化用户充值详情对话框
 */
var UsersRechargeInfoDlg = {
    usersRechargeInfoData : {}
};

/**
 * 清除数据
 */
UsersRechargeInfoDlg.clearData = function() {
    this.usersRechargeInfoData = {};
}

/**
 * 设置对话框中的数据
 *
 * @param key 数据的名称
 * @param val 数据的具体值
 */
UsersRechargeInfoDlg.set = function(key, val) {
    this.usersRechargeInfoData[key] = (typeof val == "undefined") ? $("#" + key).val() : val;
    return this;
}

/**
 * 设置对话框中的数据
 *
 * @param key 数据的名称
 * @param val 数据的具体值
 */
UsersRechargeInfoDlg.get = function(key) {
    return $("#" + key).val();
}

/**
 * 关闭此对话框
 */
UsersRechargeInfoDlg.close = function() {
    parent.layer.close(window.parent.UsersRecharge.layerIndex);
}

/**
 * 收集数据
 */
UsersRechargeInfoDlg.collectData = function() {
    this
    .set('id')
    .set('orderNo')
    .set('userId')
    .set('payType')
    .set('cash')
    .set('remark')
    .set('status')
    .set('dataFlag')
    .set('createTime')
    .set('orderImg')
    .set('checkRemark')
    .set('checkStaffId')
    .set('checkTime');
}

/**
 * 提交添加
 */
UsersRechargeInfoDlg.addSubmit = function() {

    this.clearData();
    this.collectData();

    //提交信息
    var ajax = new $ax(Feng.ctxPath + "/usersRecharge/add", function(data){
        Feng.success("添加成功!");
        window.parent.UsersRecharge.table.refresh();
        UsersRechargeInfoDlg.close();
    },function(data){
        Feng.error("添加失败!" + data.responseJSON.message + "!");
    });
    ajax.set(this.usersRechargeInfoData);
    ajax.start();
}

/**
 * 提交修改(审核通过)
 */
UsersRechargeInfoDlg.trueSubmit = function() {
    this.clearData();
    this.collectData();
    this.usersRechargeInfoData.status=1;
    //提交信息
    var ajax = new $ax(Feng.ctxPath + "/usersRecharge/update", function(data){
        Feng.success("审核完成!");
        window.parent.UsersRecharge.table.refresh();
        UsersRechargeInfoDlg.close();
    },function(data){
        Feng.error("审核失败!" + data.responseJSON.message + "!");
    });
    ajax.set(this.usersRechargeInfoData);
    ajax.start();
}
/**
 * 提交修改(审核拒绝)
 */
UsersRechargeInfoDlg.falseSubmit = function() {
    this.clearData();
    this.collectData();
    var remark=this.usersRechargeInfoData.checkRemark;
    if (remark==''|| remark==null){
        Feng.error("请输入拒绝理由!" );
        return;
    }
    this.usersRechargeInfoData.status=-1;

    //提交信息
    var ajax = new $ax(Feng.ctxPath + "/usersRecharge/update", function(data){
        Feng.success("审核完成!");
        window.parent.UsersRecharge.table.refresh();
        UsersRechargeInfoDlg.close();
    },function(data){
        Feng.error("审核失败!" + data.responseJSON.message + "!");
    });
    ajax.set(this.usersRechargeInfoData);
    ajax.start();
}
$(function() {

});
